
namespace FederatedScaleOutDatabases.DomainModel
{
    public class FederatedDatabase
    {
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = (DatabaseName != null ? DatabaseName.GetHashCode() : 0);
                hashCode = (hashCode*397) ^ (ConnectionString != null ? ConnectionString.GetHashCode() : 0);
                hashCode = (hashCode*397) ^ (ConnectionStringKey != null ? ConnectionStringKey.GetHashCode() : 0);
                return hashCode;
            }
        }

        public string DatabaseName { get; set; }

        public string ConnectionString { get; set; }

        public string ConnectionStringKey { get; set; }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((FederatedDatabase) obj);
        }

        protected bool Equals(FederatedDatabase other)
        {
            return string.Equals(DatabaseName, other.DatabaseName) 
                   && string.Equals(ConnectionString, other.ConnectionString) 
                   && string.Equals(ConnectionStringKey, other.ConnectionStringKey);
        }

        
    }
}
